<#include "/common/defaultEngine.html"/>
<@pageTheme mark="${config.optimize()?string('true', 'false')}">
<@header title="登记委托" bodyClass="white-bg" libs=["bootstrapSelect"]/>
<div class="wrapper wrapper-content ibox-content">
    <@f.form id="task-form-complete" class="form-horizontal">
    <h4 class="form-header h4"><@ctx.i18n text = "基本信息"/></h4>

    <div class="row">
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送检账户"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.tableselect name="inspectionAccount" value="" labelValue=""    url="pms/inspectionAccount/list"  checked=false
                        keyId="inspectionAccount" keyName="inspectionAccount"  boxTitle="请选择送检账户"
                        tableInfo = "[{field:'inspectionAccount',title:'送检账户'},{field:'inspectionUnit',title:'送检单位'},
                        {field:'projectName',title:'工程名称'},{field:'projectType',title:'工程类别',query: true}]"
                        placeholder="请选择送检账户" />
                        <!--<input class="form-control" name="inspectionAccount" value="" type="text"  readonly >-->
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送检单位"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="inspectionUnit" value="" type="text"  >



                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "工程项目"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <input class="form-control" name="projectName" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送样人"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="inspectionUser" value="" type="text"  >

                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托编号"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="entrustCode" value="" type="text"  readonly >
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "检测行业"/>：</label>
                <div class="col-sm-8">
                    <input class="form-control" name="testingIndustry" value="" type="text"  >

                </div>
            </div>
        </div>
    </div>


    <div class="row">
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "工程类别"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <!--<@f.select name="projectType" dictType="project_status" blankValue="" />-->
                        <input class="form-control" name="projectType"  value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "抽样人手机"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="samplersIphone" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="entrustUnit" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

    </div>

    <div class="row">
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "检验类别"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.select name="testCategory" dictType="check_type" value="1" blankValue="" blankLabel=""/>
                        <!--<input class="form-control" name="testCategory" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "见证人"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="witness" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "见证单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="witnessUnit" value="" type="text"  >
                    </div>
                </div>
            </div>

        </div>

    </div>


    <div class="row">

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "送样人手机"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="inspectionIphone" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "见证人手机"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="witnessIphone" value="" type="text"  >
                    </div>
                </div>
            </div>

        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "样品来源"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.select name="sampleSource" dictType="sample_source" value="1" blankValue="" blankLabel=""/>
                        <!--<input class="form-control" name="sampleSource" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "抽样人"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="samplers" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "抽样单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="samplersUnit" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>
        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "施工单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="constructionUnit" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

    </div>


    <div class="row">

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托联系人"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="entrustContacts" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "是否留样"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.select name="whether" dictType="sys_yes_no" value="N" blankValue="" blankLabel=""/>
                        <!--<input class="form-control" name="whether" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "样品处理"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                        <@f.select name="sampleHandle" dictType="sample_handle" value="1" blankValue="" blankLabel=""/>
                        <!--<input class="form-control" name="sampleHandle" value="" type="text"  >-->
                    </div>
                </div>
            </div>
        </div>



    </div>

    <div class="row">

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "建设单位"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="buildUnit" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>


        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "承担科室"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="bears" value="检验室" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "受理地点"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="acceptanceAddr" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>




    </div>



    <div class="row">

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "报告邮寄地址"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="mailAddr" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托金额"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="entrustAmount" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>


        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "委托押金"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="entrustDeposit" value="" type="text"  >
                    </div>
                </div>
            </div>
        </div>


    </div>

    <div class="row">

        <div class="col-sm-4">
            <div class="form-group">
                <label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "取样地点"/>：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->

                        <input class="form-control" name="samplingAddr" value="施工现场" type="text"  >
                    </div>
                </div>
            </div>
        </div>

        <!--<div class="col-sm-6">-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "登记员"/>：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<div class="input-group date">-->
                        <!--&lt;!&ndash;<span class="input-group-addon"><i class="fa fa-calendar"></i></span>&ndash;&gt;-->

                        <!--<input class="form-control" name="registerName" value="" type="text"  >-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->





    </div>

    <!--<div class="row">-->

        <!--<div class="col-sm-6">-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "取样地点"/>：</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<div class="input-group date">-->
                        <!--&lt;!&ndash;<span class="input-group-addon"><i class="fa fa-calendar"></i></span>&ndash;&gt;-->

                        <!--<input class="form-control" name="samplingAddr" value="施工现场" type="text"  >-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
        <!--</div>-->

        <!--&lt;!&ndash;<div class="col-sm-6">&ndash;&gt;-->
            <!--&lt;!&ndash;<div class="form-group">&ndash;&gt;-->
                <!--&lt;!&ndash;<label class="col-sm-4 control-label"><span style="color: red; ">*</span><@ctx.i18n text = "登记员"/>：</label>&ndash;&gt;-->
                <!--&lt;!&ndash;<div class="col-sm-8">&ndash;&gt;-->
                    <!--&lt;!&ndash;<div class="input-group date">&ndash;&gt;-->
                        <!--&lt;!&ndash;&lt;!&ndash;<span class="input-group-addon"><i class="fa fa-calendar"></i></span>&ndash;&gt;&ndash;&gt;-->

                        <!--&lt;!&ndash;<input class="form-control" name="registerName" value="" type="text"  >&ndash;&gt;-->
                    <!--&lt;!&ndash;</div>&ndash;&gt;-->
                <!--&lt;!&ndash;</div>&ndash;&gt;-->
            <!--&lt;!&ndash;</div>&ndash;&gt;-->
        <!--&lt;!&ndash;</div>&ndash;&gt;-->





    <!--</div>-->


</div>
<table class="table-form-body table table-hover table-bordered" >
    <thead >
    <tr>
        <td colspan="13">
            <button name="btn-insert" type="button" class="btn btn-primary btn-rounded btn-sm">插入行</button>
            <button name="btn-copy" type="button" class="btn btn-primary btn-rounded btn-sm">复制行</button>
            <button name="btn-del" type="button" class="btn btn-primary btn-rounded btn-sm">删除行</button>
            <button name="btn-del-all" type="button" class="btn btn-primary btn-rounded btn-sm">删除全部</button>
            <button name="btn-import" type="button" class="btn btn-primary btn-rounded btn-sm">导入数据</button>
        </td>
    </tr>
    <tr>
        <th width="10%">序号</th>
        <th>检验编号</th>
        <th>执行标准</th>
        <th>种类及规格</th>
        <th>收费项目</th>
        <th>取样数量</th>
        <th>代表批量</th>
        <th>产地</th>
        <th>使用部位</th>
        <th>样品描述</th>
        <th>说明</th>
        <th>报告备注</th>
        <th>备注1</th>
    </tr>
    </thead>
    <tbody name="items" >
    <tr data-id="">
        <td style="width:10%"><span>1 </span></td>
        <td >
            <input name="" type="text">
        </td>
        <td>
            <input name="" type="text">
        </td>
        <td >
            <input name="" type="text">
        </td>
        <td>
            <input name="" type="text">
        </td>
        <td >
            <input name="" type="text">
        </td>
        <td>
            <input name="" type="text">
        </td>
        <td >
            <input name="" type="text">
        </td>
        <td>
            <input name="" type="text">
        </td>
    </tr>
    </tbody>
</table>



</@f.form>
<div class="hr-line-dashed"></div>
<div class="row" style="text-align: center;" id="_addTab">
    <!--<button type="button" class="btn btn-sm btn-primary" onclick="opt.form.submit()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;-->
    <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i><@ctx.i18n text = "保存"/></button>&nbsp;
    <button type="button" class="btn btn-sm btn-danger" onclick="opt.modal.closeTab()"><i class="fa fa-reply-all"></i><@ctx.i18n text = "关闭"/></button>
</div>
</div>
<@footer>
<script type="text/javascript">
    var prefix = baseURL + "pms/registerEntrust";

    $('#tipBut button').click(function(){
        $('#comment').text($(this).text())
    });

    $("#task-form-complete").validate({
        focusCleanup: true
    });

    function tableCallback(id, event, index, layero, nodes){
        console.log("aaaaaaaaaaaaaaa")
        if(id == "inspectionAccount"){
            console.log("弹出表格选择===>>>>: id:" + id + "  event:" + event + " index:" + index + "  layero:"+ layero + " nodes:" + JSON.stringify(nodes));
            console.log(nodes.table[0]);
            var data = nodes.table[0];
            console.log(data)
            console.log("11111111111")
            console.log(data.testingIndustry)
            console.log("11111111111")
            $("input[name=inspectionUnit]").val(data.inspectionUnit);//送检单位
            $("input[name=projectName]").val(data.projectName);//工程名字
            $("input[name=projectType]").val(data.projectType);//工程类别
            $("input[name=testingIndustry]").val(data.testingIndustry);//检测行业
            $("input[name=entrustUnit]").val(data.entrustUnit);//委托单位
            $("input[name=inspectionUnit]").val(data.inspectionUnit);//检验行业
            $("input[name=witnessIphone]").val(data.witnessIphone);//见证人
            $("input[name=witnessUnit]").val(data.witnessUnit);//见证单位
            $("input[name=sampleSource]").val(data.sampleSource);//样品来源
            // $("input[name=samplingAddr]").val(data.samplingAddr);//取样地点
            $("input[name=samplersUnit]").val(data.samplersUnit);//抽样单位
            $("input[name=constructionUnit]").val(data.constructionUnit);//施工单位
            $("input[name=buildUnit]").val(data.buildUnit);//建设单位
            $("input[name=acceptanceAddr]").val(data.region);//受理地点

        }
    }

    function submitHandler() {

       //  var arrivalAmount= parseFloat($('input[name="arrivalAmount"]').val());
       //  var claimAmount= parseFloat($('input[name="claimAmount"]').val());
       //  console.log(arrivalAmount);
       //  console.log(claimAmount);
       //  console.log(claimAmount>arrivalAmount);
       // if(claimAmount>arrivalAmount){
       //   //  alert("已认领金额不能大于到账金额");
       //   return  opt.modal.alertWarning("已认领金额不能大于到账金额");
       // }

        if (opt.validate.form()) {
            opt.operate.saveTab(prefix + "/add", $('#task-form-complete').serialize());
        }
    }
</script>
</@footer>
</@pageTheme>